Skip to content

Honor MySQL contracts in managed PHPUnit - #1995

Merged
chubes4 merged 1 commit into
mainfrom
fix/1986-mysql-contract
Jul 23, 2026
Merged

Honor MySQL contracts in managed PHPUnit#1995
chubes4 merged 1 commit into
mainfrom
fix/1986-mysql-contract

Conversation

@chubes4

@chubes4 chubes4 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a generic databaseType contract to the supported PHPUnit recipe builder
  • translate explicit MySQL intent into the existing disposable MySQL service contract with canonical DB_* outputs
  • generate managed wp-tests-config.php values from that service and fail before test execution instead of substituting SQLite
  • preserve omitted/default PHPUnit recipes on the existing in-memory SQLite backend

Root cause and ownership

The component setting never reached WP Codebox: the external PHPUnit adapter reads the caller's settings but does not place database_type in its builder options. WP Codebox's public PHPUnit builder therefore had no database-backend field, emitted no MySQL service, and wordpress.phpunit unconditionally wrote DB_NAME=':memory:'.

This PR owns the WP Codebox boundary by adding the generic databaseType builder option. databaseType: \"mysql\" now emits an ordinary recipe inputs.services MySQL declaration plus database-type=mysql; no caller-specific names or policy enter generic WP Codebox layers. The caller adapter can now map its setting to this public field rather than inventing runtime behavior.

Before / after

Before, managed PHPUnit always generated SQLite test constants even when the surrounding component required MySQL. After, explicit MySQL provisions the supported disposable service, exposes its host, port, database, username, and password to Playground, and writes those values into wp-tests-config.php. Missing external service support produces a precise refusal before the workload runs. Omitting databaseType retains SQLite compatibility.

Verification

  • npm run build - passed
  • npm run test:runtime-services - passed
  • npx tsx tests/phpunit-project-autoload.test.ts - passed
  • npm run test:disposable-mysql-mysqli-e2e - skipped because Docker is unavailable on this host
  • git diff --check - passed
  • npm run check - reached a pre-existing unrelated command-registry-smoke failure: wordpress.collect-workload-result outputShape should mention outputSchema id; production-boundary enforcement, build, and preceding smoke checks passed

Tests prove explicit MySQL creates canonical service outputs and reaches the managed PHPUnit config, unsupported MySQL refuses SQLite substitution before invoking the workload, and an omitted database contract preserves the in-memory SQLite default.

Addresses #1986.

@chubes4
chubes4 merged commit 24fb095 into main Jul 23, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant